import { createEntityAdapter, createSlice } from '@reduxjs/toolkit';
import { WallpaperType } from '@interfaces';

const entityAdapter = createEntityAdapter({
  selectId: (entity: WallpaperType) => entity._id,
});


const { actions, reducer } = createSlice({
  name: 'entity',
  initialState: entityAdapter.getInitialState(),
  reducers: {
    addOne: (state, action) => {
      entityAdapter.addOne(state, action);
    }
  },
})

export const { addOne } = actions;

export default reducer;
